public class AssocCache extends Cache
{
	int[] cache;
	boolean[] dataVaild;
	Object[] cacheData;
	int ignored;
	int tag;
	int ii;
	int count = 0;

	AssocCache(int paramInt1, int paramInt2)
	{
		this.size = paramInt1;
		this.line_size = paramInt2;
		this.cache = new int[this.size / this.line_size];
		this.cacheData = new Object[this.size / this.line_size];
		this.dataVaild = new boolean[this.size / this.line_size];
		for (int i = 0; i < this.size / this.line_size; i++)
			this.dataVaild[i] = false;
	}

	public Object cacheSearch(int paramInt)
	{
		// int i = paramInt % (2 * this.size) / (this.line_size * 2);
		// int index = ((paramInt / this.line_size) % this.size)
		// % (this.size / this.line_size);
		int ignored = (paramInt % this.line_size);
		int tag = paramInt / this.line_size;
		for (int i = 0; i < this.size / this.line_size; i++)
		{
			if (this.cache[i] == tag && this.dataVaild[i] != false)
			{
				ii = i;
				return this.cacheData[i];
			}
		}
		return null;
	}

	public oldCacheLineInfo cacheNewEntry(int paramInt)
	{
		// int i = paramInt % (2 * this.size) / (this.line_size * 2);
		// int index = ((paramInt / this.line_size) % this.size)
		// % (this.size / this.line_size);
		int ignored = (paramInt % this.line_size);
		int tag = paramInt / this.line_size;

		oldCacheLineInfo localoldCacheLineInfo = new oldCacheLineInfo();
		localoldCacheLineInfo.data = (this.cacheData[count] = new Integer(-1));
		localoldCacheLineInfo.old_valid = this.dataVaild[count];
		this.cache[count] = tag;
		this.dataVaild[count] = true;
		count++;

		if (count >= this.size / this.line_size)
		{
			count = 0;
		}

		return localoldCacheLineInfo;
	}

	public void cacheWriteData(Object paramObject)
	{
		this.cacheData[ii] = paramObject;
	}
}
